FROM golang:alpine AS builder

WORKDIR /usr/local/app/
COPY . /usr/local/app/
RUN go env -w GOPROXY=https://goproxy.cn,direct \
    && go mod tidy \
    && go build -p 1 -o login_rpc login-rpc/login_rpc.go

FROM alpine:latest

WORKDIR /usr/local/app/

COPY --from=builder  /usr/local/app/login_rpc ./
COPY --from=builder  /usr/local/app/login-rpc/etc/login_rpc.yaml ./
RUN chmod +x login_rpc
EXPOSE 8080
ENTRYPOINT ["./login_rpc"]
CMD ["-f", "login_rpc.yaml"]
